package com.xuwang.controller;


import com.xuwang.service.impl.SupervisoryInformationServiceImpl;
import com.xuwang.vo.CaseFilingVo;
import com.xuwang.vo.ComplaintsAcceptInsertVo;
import com.xuwang.vo.SupervisoryInformationInsertVo;
import com.xuwang.vo.SupervisoryInformationVo;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.text.ParseException;
import java.util.Map;

/**
 *@ClassName SupervisoryInformationController
 *@Description TODO
 *@Author OuJunchen
 *@Date 2021/9/14 下午3:45
 *@Version 1.0
 */
@RestController
@RequestMapping("/supervisoryInformationController")
@Api(value = "(SupervisoryInformation)督察信息表管理", tags = "(SupervisoryInformation)督察信息表管理接口API")
@ApiResponses({
        @ApiResponse(code = 400, message = "请求参数不完整或者错误"),
        @ApiResponse(code = 302, message = "临时重定向，被拦截器栏了"),
        @ApiResponse(code = 304, message = "缓存数据"),
        @ApiResponse(code = 404, message = "找不到页面"),
        @ApiResponse(code = 405, message = "请求方式不正确，比如后台接收是post，但前端请求的是get"),
        @ApiResponse(code = 406, message = "页面地址和接口名冲突"),
        @ApiResponse(code = 415, message = "请求格式不正确，前端可能没有把请求头修改为json，也可能前端请求的json对象没有转换为字符串"),
        @ApiResponse(code = 500, message = "后台服务逻辑错误")
})
public class SupervisoryInformationController {

    @Resource
    //服务对象
    private SupervisoryInformationServiceImpl supervisoryInformationService;

    /**
     * 查询所有案件备案情况
     *
     * @param supervisoryInformationVo vo对象
     * @Author OuJunchen
     * @return 所有数据
     */
    @RequestMapping(value = "/selectAll", method = RequestMethod.GET)
    @ApiOperation(value = "查询督察信息表管理",notes = "督察信息表管理",httpMethod = "GET")
    public Map<String, Object> selectAll(@RequestParam String page, @RequestParam String limit, @ApiParam(name = "supervisoryInformationVo",value = "vo模型",required = false) SupervisoryInformationVo supervisoryInformationVo) {
        return this.supervisoryInformationService.selectAll(Integer.parseInt(page), Integer.parseInt(limit), supervisoryInformationVo);
    }

    /**
     * 通过一个pojo对象新增单条数据
     *
     * @param supervisoryInformationInsertVo insert VO 对象
     * @Author OuJunchen
     * @return 返回map
     */
    @RequestMapping(value = "/insert", produces = "application/json;charset=UTF-8")
    @ResponseBody
    @ApiOperation(value = "插入更新督察信息表管理", notes = "插入更新督察信息表管理", httpMethod = "POST", response = String.class)
    public Map<String, Object> insert(@RequestBody @ApiParam(name = "supervisoryInformationInsertVo",value = "vo模型",required = true) SupervisoryInformationInsertVo supervisoryInformationInsertVo) {
        return this.supervisoryInformationService.insertOrUpdateSelective(supervisoryInformationInsertVo);
    }

    /**
     * 通过主键删除单条数据
     *
     * @param id 主键
     * @Author OuJunchen
     * @return 单条数据
     */
    @RequestMapping(value = "/deleteById", method = RequestMethod.POST)
    @ApiOperation(value = "删除督察信息表管理",notes = "根据一个主键删除督察信息表管理",httpMethod = "POST")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "id集合(格式例子：1,2,3)",paramType = "query",dataType = "String",required = true),
    })
    public Map<String, Object> deleteById(@RequestParam("id") String id) {
        return this.supervisoryInformationService.deleteByPrimaryKey(id);
    }
}
